import http from '@/utils/http'

export const getQuestListAPI = ({ pageNo, pageSize, order }) =>
  http.get('/api/question/list', {
    params: { pageNo, pageSize, order }
  })
export const getQuestListWithTagNameAPI = ({ pageNo, pageSize, order, tag }) =>
  http.get('/api/question/list', {
    params: { pageNo, pageSize, order, tag }
  })

export const getHottestQuestListAPI = () =>
  http.get('/api/question/list', {
    params: { pageNo: 0, pageSize: 6, order: 'hot' }
  })


export const getQuestDetailAPI = (id) => http.get(`/api/question/${id}`)
export const addQuestionAPI = (params) => http.post('/api/question', params)
export const addQuestionWithAnswerAPI = (params) => http.post('/api/question/answer', params)

export const deleteQuestionAPI = (id) => http.delete(`/api/question/${id}`)